import cn.hutool.core.codec.Base64;
import com.baidu.aip.face.AipFace;
import org.json.JSONObject;

import java.io.File;

public class Sample{
    //设置APPID/AK/SK
    public static final String APP_ID = "25285003";
    public static final String API_KEY = "ia3tSCnfD79iuakF9tgxO7bh";
    public static final String SECRET_KEY = "E3APmXAdGiQSxaf02tV5U3Y1fbG1Pq2B";

    public static void main(String[] args) {
        // 初始化一个AipFace
        AipFace client = new AipFace(APP_ID, API_KEY, SECRET_KEY);

        // 可选：设置网络连接参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);
        // 调用接口
        String image = Base64.encode(new File("C:\\Users\\Cdb\\Desktop\\班级\\src=http___up.enterdesk.com_edpic_source_53_0a_da_530adad966630fce548cd408237ff200.jpg&refer=http___up.enterdesk.jfif"));

        String imageType = "BASE64";
    
        // 人脸检测
        JSONObject res = client.detect(image, imageType,null);
        System.out.println(res.toString(2));
        
    }
}